package com.yakami.ocean.event;

/**
 * Created by Yakami on 2016/3/30.
 *
 */
@SuppressWarnings("all")
public class Event<T> {

    public enum EventType {
        SET_RECOMMEND_HEIGHT, //用于主页推荐列表的recyclerview的动态调整高度
        SET_LATEST_HEIGHT,
        SET_QUALITY_HEIGHT,
        NEXT_PROBLEM,  //下一题
        LOAD_ERROR, //用于通知LoadFragment，显示相关信息
        LOADED_SUCCESSFUL,
        LOGIN_SUCCESS, //登录成功，通知drawer
        OUT_LOGIN,
    }

    public EventType type;
    public T message;

    public static <O> Event<O> just(O t) {
        Event<O> event = new Event<>();
        event.message = t;
        return event;
    }

    //用于转换类型，否则直接取message会是object类型
    public <T> T getMessage() {
        return (T) message;
    }

}


